/* 覆盖antd样式 */

/* ========== 基础组件覆盖 ========== */

/* 覆盖不生效时候字体显示太浅 */
.ant-input[disabled],
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector,
.ant-select-disabled.ant-select-multiple .ant-select-selection-item,
.ant-picker-input > input[disabled] {
  color: rgba(0, 0, 0, 0.25);
  background-color: #f5f5f5;
  border-color: #d9d9d9;
  cursor: not-allowed;
  opacity: 1;
}

/* 确保禁用状态的 Select 组件完整置灰效果 */
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector {
  background-color: #f5f5f5;
  border-color: #d9d9d9;
  color: rgba(0, 0, 0, 0.25);
  cursor: not-allowed;
}

.ant-select-disabled.ant-select .ant-select-arrow {
  color: rgba(0, 0, 0, 0.25);
}

/* 覆盖 list action 样式 */
.ant-list-item-action {
  margin-left: 0;
}

/* 覆盖 card action 样式 */
.ant-card-actions {
  background: var(--gray-light);
}

/* 覆盖：用于主题切换 button 背景色 */
.ant-btn-color-dangerous.ant-btn-variant-link {
  color: var(--warning-color);
}

/* ========== ProLayout 覆盖 ========== */

.ant-layout {
  height: 100%;
}

.ant-pro-layout {
  height: 100%;
  background: transparent;
}

.ant-pro-layout .ant-pro-layout-content {
  padding-inline: 24px;
  padding: 24px;
  margin: 0;
  background: transparent !important;
}

/* Header 样式 */
.ant-pro-layout .ant-layout-header {
  background: var(--theme-primary) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Sider 样式 */
.ant-pro-layout .ant-layout-sider {
  background: var(--theme-bg-white) !important;
  border-right: 1px solid var(--theme-border);
  position: relative;
}

/* Sider Logo 区域 */
.ant-pro-layout .ant-layout-sider .ant-pro-sider-logo {
  background: transparent;
  border-bottom: 1px solid var(--theme-border);
}

/* ========== 菜单样式覆盖 ========== */

/* 菜单样式 */
.ant-pro-layout .ant-layout-sider .ant-menu,
.ant-pro-layout .ant-layout-header .ant-menu {
  background: transparent;
  border-right: none;
  color: var(--theme-text-secondary);
}

/* Header 部分菜单默认样式 */
.ant-pro-layout .ant-layout-header .ant-menu,
.ant-pro-layout .ant-layout-header .ant-menu-item {
  color: white !important;
}

.ant-pro-layout .ant-layout-sider .ant-menu-item:hover {
  background: var(--theme-primary-bg);
  color: var(--theme-primary);
  border-radius: var(--theme-border-radius-lg);
}

/* Header 部分菜单hover状态 */
.ant-pro-layout .ant-layout-header .ant-menu-item:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: var(--theme-border-radius-lg);
}

/* 菜单选中状态 - 提高选择器优先级 */
.ant-pro-layout .ant-layout-sider .ant-menu .ant-menu-item-selected {
  background: var(--theme-primary-bg);
  color: var(--theme-primary);
  border-radius: var(--theme-border-radius-lg);
  position: relative;
  font-weight: 600;
}

.ant-pro-layout .ant-layout-sider .ant-menu .ant-menu-item-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--theme-primary);
  border-radius: 0 2px 2px 0;
}

/* Header 部分菜单选中状态 */
.ant-pro-layout .ant-layout-header .ant-menu .ant-menu-item-selected {
  background: transparent;
  color: white;
  font-weight: 700;
  position: relative;
}

.ant-pro-layout .ant-layout-header .ant-menu .ant-menu-item-selected::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 1px;
}

/* 菜单激活状态 - 提高选择器优先级 */
.ant-pro-layout .ant-layout-sider .ant-menu .ant-menu-item-active {
  background: rgba(74, 144, 226, 0.1);
  color: var(--theme-primary);
  border: 1px solid rgba(74, 144, 226, 0.3);
  border-radius: var(--theme-border-radius-lg);
  transition: none;
}

/* Header 部分菜单激活状态 */
.ant-pro-layout .ant-layout-header .ant-menu .ant-menu-item-active {
  background: transparent;
  color: white;
  font-weight: 500;
  transition: none;
}

/* ========== 卡片样式覆盖 ========== */

/* 覆写卡片 */
.ant-card-body {
  padding: var(--margin-padding);
}

.ant-card {
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border);
  box-shadow: var(--theme-shadow);
  border-radius: 16px;
  transition: var(--theme-transition);
  position: relative;
  overflow: hidden;
}

.ant-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--theme-primary-gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.ant-card:hover::before {
  opacity: 1;
}

/* ========== 表格样式覆盖 ========== */

/* 覆盖表格宽高 */
.ant-table-thead > tr > th,
.ant-table-tbody > tr > td,
.ant-table tfoot > tr > th,
.ant-table tfoot > tr > td {
  padding: 0.6rem 0.5rem;
}

/* 覆盖 表格斑马效果，不过固定列不生效 */
.ant-table table tr:nth-child(even) {
  background: var(--gray-light) !important;
}

.ant-table-cell-fix-left,
.ant-table-cell-fix-right {
  background: none; /* 覆盖原来的白色 */
}

.ant-table {
  background: var(--theme-bg-primary) !important;
}

.ant-table-thead > tr > th {
  background: var(--theme-bg-tertiary) !important;
  border-bottom: 1px solid var(--theme-border);
}

.ant-table-tbody > tr > td {
  border-bottom: 1px solid var(--theme-border) !important;
}

.ant-table-tbody > tr:hover > td {
  background: var(--theme-bg-tertiary) !important;
}

/* 覆盖 table 滚动条样式 */
.ant-table-body {
  scrollbar-width: auto;
  scrollbar-color: auto;
  /* 为滚动区域添加自定义样式 */
  &::-webkit-scrollbar {
    width: 4px; /* 设置滚动条的宽度 */
    height: 4px; /* 设置滚动条的高度 */
    border-radius: 2px;
    background-color: var(--gray-main);
  }

  /* 为滚动条轨道自定义样式 */
  &::-webkit-scrollbar-track {
    border-radius: 2px;
    -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0);
    background-color: #fff;
  }

  /* 为滚动条滑块自定义样式 */
  &::-webkit-scrollbar-thumb {
    border-radius: 2px;
    -webkit-box-shadow: inset 0 0 4px rgba(0, 0, 0, 0);
    background-color: var(--gray-three);
  }
}

/* ========== 按钮样式覆盖 ========== */

.ant-btn {
  border-radius: 12px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.ant-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.ant-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--theme-glow), var(--theme-shadow-lg) !important;
}

.ant-btn:hover::before {
  left: 100%;
}

.ant-btn-primary {
  background: var(--theme-primary-gradient) !important;
  border: none !important;
  color: white !important;
}

.ant-btn-primary:hover {
  background: var(--theme-primary-gradient) !important;
  filter: brightness(1.1) saturate(1.2);
}

/* ========== 其他组件覆盖 ========== */

/* 覆盖 modal 默认高度 */
.ant-modal-wrap .ant-modal-body .ant-card-body {
  height: 24rem;
}

.ant-modal-content {
  background: var(--theme-bg-primary);
  border-radius: 16px;
  box-shadow: var(--theme-shadow);
  border: 1px solid var(--theme-border);
}

.ant-modal-header {
  background: var(--theme-bg-primary);
  border-bottom: 1px solid var(--theme-border);
  border-radius: 16px 16px 0 0;
}

/* 抽屉 */
.ant-drawer-content {
  background: var(--theme-bg-primary);
}

.ant-drawer-header {
  background: var(--theme-bg-primary);
  border-bottom: 1px solid var(--theme-border);
}

/* 下拉菜单 */
.ant-dropdown {
  background: var(--theme-bg-primary);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-border-radius-lg);
  box-shadow: var(--theme-shadow);
  backdrop-filter: blur(10px);
}

/* 工具提示 */
.ant-tooltip-inner {
  background: var(--theme-bg-tertiary) !important;
  color: var(--theme-text-primary) !important;
  border-radius: var(--theme-border-radius) !important;
  backdrop-filter: blur(10px);
}

/* 面包屑样式 */
.ant-breadcrumb {
  color: var(--theme-text-secondary);
}

.ant-breadcrumb a {
  color: var(--theme-text-secondary);
  transition: var(--theme-transition);
}

.ant-breadcrumb a:hover {
  color: var(--theme-primary);
}

/* 标签页样式 */
.ant-tabs-tab {
  color: var(--theme-text-secondary);
  transition: var(--theme-transition);
}

.ant-tabs-tab-active {
  color: var(--theme-primary);
}

.ant-tabs-ink-bar {
  background: var(--theme-primary);
}

/* ========== ProTable 覆盖 ========== */

/* 强制隐藏 ProTable 的 alert 组件 */
.ant-pro-table-alert {
  display: none;
}

/* 更强力的选择器确保隐藏 */
.page-template .ant-pro-table-alert,
.page-template-table-card .ant-pro-table-alert,
.ant-pro-table .ant-pro-table-alert {
  display: none;
}

/* ========== 响应式优化 ========== */
@media (max-width: 768px) {
  .ant-pro-layout .ant-layout-content {
    padding: 16px;
  }

  .ant-card {
    margin-bottom: 16px;
  }
}
